﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;


class ExtractSentences
{
    public static MatchCollection ExtractSentencesThatContain(string text, string word)
    {
        string pattern = @"\s((\w|\s)*\s)?" + Regex.Escape(word) + @"((\.|\!|\?)|(\s(\w|\s)*)(\.|\!|\?))";
        MatchCollection matches = Regex.Matches(text, pattern, RegexOptions.IgnoreCase);
        return matches;
    }

    static void Main(string[] args)
    {
        string text = @" Whaaat test. HxhAxhtestLawd. Damn this test damn. Test it Damn.";
        MatchCollection sentences = ExtractSentencesThatContain(text, "test");
        foreach (var sentence in sentences)
        {
            Console.WriteLine(sentence);
        }
    }
}

